import glob
import shutil
import os

def batch_rename_images(directory, new_name):
    count = 1
    for filename in glob.glob(directory + "/*.xml"):  # 使用glob筛选.jpg格式的文件
        new_filename = new_name + str(count) + ".xml"
        new_path = os.path.join(directory, new_filename)
        shutil.move(filename, new_path)
        count += 1

batch_rename_images("E:\\pythonsource\\数据集\\Light-HaGRID\\inval\\fist\\Annotations", "fist")